<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>
<%
	request.setAttribute("modelConfigPath", "groupActivity");
%>
<style type="text/css">
.area {
	margin: 0px;
	padding: 0;
	border: 0px;
	text: center;
}
</style>
<div class="table-responsive">
	<t:form id="groupDutiesForm" commandName="groupDuties"
		action="/admin/groupActivity/groupDuty/save" method="post">
		<table class="cntable table table-bordered dataTable table-groupDuty">
			<thead>
				<tr>
					<th style="width: 30px">周</th>
					<th style="width: 80px">时间节点</th>
					<th style="width: 100px">值班人</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="groupDuty" items="${groupDuties}" varStatus="status">
					<tr data-id="${groupDuty.id}">
						<td><input name="groupDuties[${status.index }].id"
							style="display: none" />${status.index+1}</td>
						<td><fmt:formatDate value="${groupDuty.weekDate}"
								pattern="yyyy/MM/dd" /></td>
						<td><select name="groupDuties[${status.index }].employeeId"
							value="${groupDuty.employeeId }"
							class="custom-select2 select2-hidden-accessible">
								<c:forEach var="employee" items="${employees }">
									<c:if test="${groupDuty.employeeId == employee.value }">
										<option value="${employee.value }" selected="selected">${employee.text }</option>
									</c:if>
									<c:if test="${groupDuty.employeeId != employee.value }">
										<option value="${employee.value }">${employee.text }</option>
									</c:if>
								</c:forEach>
						</select></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</t:form>
</div>

<script type="text/javascript">
	function saveForm() {
		$("#groupDutiesForm").submit();
	}
</script>